//
//  UIWindow+Extension.m
//  01-黑马微博
//
//  Created by lanou3g on 15/9/11.
//  Copyright (c) 2015年 heima. All rights reserved.
//

#import "UIWindow+Extension.h"
#import "HWTabBarViewController.h"
#import "NewFeatureViewController.h"
@implementation UIWindow (Extension)
- (void)switchRootViewController{
    //    存储当前版本号（上一次使用版本）
    NSString *lastVersion = [[NSUserDefaults standardUserDefaults] objectForKey:HWVersion];
    //    获得当前软件的版本号
    NSString *currentVersion = [NSBundle mainBundle].infoDictionary[HWVersion];
    if ([currentVersion isEqualToString:lastVersion]) {
        HWTabBarViewController *tabBarVc = [[HWTabBarViewController alloc] init];
        self.rootViewController = tabBarVc;
    }else{
        //设置根控制器
        self.rootViewController = [[NewFeatureViewController alloc] init];
        [[NSUserDefaults standardUserDefaults] setObject:currentVersion forKey:HWVersion];
        [[NSUserDefaults standardUserDefaults] synchronize];
    }

}
@end
